<%@ page language="java"  contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
<title>test page</title>
<script type="text/javascript" src="${ctx }/js/jquery-3.2.1.js"></script>
<script type="text/javascript" src="${ctx }/js/admin/pagination/kkpager.js"></script>
<link rel="stylesheet" type="text/css" href="${ctx }/js/admin/pagination/kkpager_blue.css" />
</head>
<body>
<div style="width:800px;margin:0 auto;">
<div id="kkpager" ></div>
</div>
<script type="text/javascript">
function getParameter(name) { 
	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); 
	var r = window.location.search.substr(1).match(reg); 
	if (r!=null) return unescape(r[2]); return null;
}

//init
$(function(){
	var total=$("#total").val();
	var pageSize=getParameter('pageSize');
	var totalPage = (total-1)/pageSize+1;
	var totalRecords = total;
	var pageNo = getParameter('pageNow');
	var search=window.location.search;
	var pathname=window.location.pathname;
	var searchArray=search.split("&");
	search=pathname+"?";
	for(var i=0,k=searchArray.length;i<k;i++){
	 if(searchArray[i].indexOf("pageNow") < 0){
	  search+=searchArray[i].replace("?","")+"&pageNow=";
	 }
	}
	kkpager.generPageHtml({
		pno : pageNo,
		//总页码
		total : totalPage,
		//总数据条数
		totalRecords : total,
/* 		//链接前部
		hrefFormer : search,
		//链接尾部
		hrefLatter : '', */
		getLink : function(n){
			return search+n;
		}
		/*
		,lang				: {
			firstPageText			: '首页',
			firstPageTipText		: '首页',
			lastPageText			: '尾页',
			lastPageTipText			: '尾页',
			prePageText				: '上一页',
			prePageTipText			: '上一页',
			nextPageText			: '下一页',
			nextPageTipText			: '下一页',
			totalPageBeforeText		: '共',
			totalPageAfterText		: '页',
			currPageBeforeText		: '当前第',
			currPageAfterText		: '页',
			totalInfoSplitStr		: '/',
			totalRecordsBeforeText	: '共',
			totalRecordsAfterText	: '条数据',
			gopageBeforeText		: '&nbsp;转到',
			gopageButtonOkText		: '确定',
			gopageAfterText			: '页',
			buttonTipBeforeText		: '第',
			buttonTipAfterText		: '页'
		}*/
		
		//,
		//mode : 'click',//默认值是link，可选link或者click
		//click : function(n){
		//	this.selectPage(n);
		//  return false;
		//}
	});
});
</script>

</body>
</html>